<?PHP use_javascript("/js/i18n/grid.locale-cn.js") ?>
<?PHP use_javascript("/js/jquery.jqGrid.min.js") ?>
<?PHP use_stylesheet("/css/ui.jqgrid.css") ?>
<?PHP include_partial("rightnow") ?>



<script type="text/javascript">
    $(document).ready(function(){

        $("#table_vend_list").jqGrid({
            url: "<?PHP echo url_for("vend/getVendList.json") ?>",
            datatype: "json",
            width: 700,
            colNames:["Id","供货商编号","供货商名称","完整供货商名称","供货商类别","联系地址","其它联系地址","邮政编码","电话号码","联系人","传真","备注","录入人员","录入日期","最后维护日期","操作"],
            colModel:[
                {name: "id", hidden: true},
                {name: "vend_no"},
                {name: "vend_name"},
                {name: "vend_fname", hidden: true},
                {name: "vend_type" },
                {name: "vend_addr", hidden: true },
                {name: "vend_addr1", hidden: true },
                {name: "vend_zip", hidden: true },
                {name: "vend_tel", hidden: true },
                {name: "vend_contact", hidden: true },
                {name: "vend_fax", hidden: true },
                {name: "vend_memo", hidden: true },
                {name: "vend_opr"},
                {name: "created_at"},
                {name: "updated_at"},
                {name: "act", width: 30}
            ],
            rowNum: 20,
            rowList: [10,20,30],
            pager: "#pager_vend_list",
            sortname: 'id',
            viewrecords: true,
            sortorder: "desc",
            caption: "&nbsp;",
            gridComplete: function() {
                var ids = jQuery("#table_vend_list").jqGrid('getDataIDs');
                for(var i=0; i < ids.length; i++) {
                    var id = ids[i];
                    var btn = "<a href='edit/id/" + id + "' ><img id='vend_edit_" + id + "' title='删除/修改供货商资料' src='/images/icons/page_edit.png' alt='维护' /></a>&nbsp;"
                    $("#table_vend_list").jqGrid('setRowData', ids[i], {act: btn})
                }
            }
        });
        $("#table_vend_list").jqGrid('navGrid','#pager_vend_list',{edit:false, add:false, del:false })
            .jqGrid('navButtonAdd',"#pager_vend_list",{
                caption:"显示/隐藏列",
                id:"show_hide_column",
                onClickButton: function() {
                    $('#table_vend_list').setColumns()
                }
        });


    });

</script>

<div id="box">
    <h3>供货商资料维护</h3>
    <table id="table_vend_list" width="100%" align="center">
    </table>
    <div id="pager_vend_list"></div>
</div>
<br />
